package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.bean.OutCarBean;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IOutCarMapper extends BaseMapper<OutCarBean> {
    public List<OutCarBean> findByUserId(Integer id);

    @Select("SELECT SUM(oc.oc_num*p_oprice) FROM t_outcar oc LEFT JOIN t_product on" +
            " fk_productId = pk_productId WHERE fk_userId =#{userId}")
    @ResultType(Integer.class)
    public  Integer sumPrice(Integer userId);
}
